<?php

namespace app\admin\controller\channel;

use app\admin\controller\AdminController;
use app\admin\service\channel\H5Service;
use think\response\Json;

class H5 extends AdminController
{
    /**
     * 获取H5渠道配置
     * @return Json
     */
    public function getH5Config()
    {
        $result = H5Service::getH5Config();
        return $this->data($result);
    }

    /**
     * 设置H5渠道配置
     * @return Json
     */
    public function setH5Config()
    {
        $params = $this->postData([
            ['status', ''],
            ['close_url', '']
        ]);
        $result = H5Service::setH5Config($params);
        if(true === $result) {
            return $this->success([], '设置成功');
        } else {
            return $this->error(H5Service::getError());
        }
    }
}